import HttpService from '../../app/services/httpService.js';

class EntryService extends HttpService {
    constructor($http, $q){
        super($http, $q)

        this.URL = this.baseUrl();

        this.OBJ = {
        	EntryDetailUrl: this.URL + '/registersetup/detail?race_id=',
            EntryDetailUpdateUrl:  this.URL + '/registersetup/update?race_id=',
            RegisterFieldListsUrl:  this.URL + '/registerfield/lists?race_id=',
            RegisterFieldUpdateUrl:  this.URL + '/registerfield/update?race_id=',
            RegisterBibImportUrl:  this.URL + '/registerpicknum/import?race_id=',
            RegisterBibClearUrl:  this.URL + '/registerpicknum/clear?race_id=',
            RegisterVerifyUrl:  this.URL + '/register/verify?register_id=',
            RegisterfieldAddUrl:  this.URL + '/registerfield/add?race_id=',
            RegisterfieldAddUrl:  this.URL + '/registerfield/add?race_id=',
            RegisterfieldDelUrl:  this.URL + '/registerfield/del?race_id=',
            RegisterPaystatusUrl:  this.URL + '/register/setpay?register_id=',
            RegisterfieldEditUrl:  this.URL + '/registerfield/edit?race_id=',
            RegisterCancelUrl:  this.URL + '/register/cancel?register_id=',
        }

    }

    /* 获取报名设置详情 */
    getEntryDetail(headers, search) { 
        return this.getRequest(this.OBJ.EntryDetailUrl, headers, search);
    }

    /* 更新报名设置项 */
    postEntryDetailUpdate(params, headers, search) {
        return this.postMultipart(this.OBJ.EntryDetailUpdateUrl, params, headers, search);
    }

    /* 获取报名字段 */
    getRegisterFieldLists(headers, search) { 
        return this.getRequest(this.OBJ.RegisterFieldListsUrl, headers, search);
    }

    /* 更新报名资料项 */
    postRegisterFieldUpdate(params, headers, search) {
        return this.postMultipart(this.OBJ.RegisterFieldUpdateUrl, params, headers, search);
    }

    /* 导入选手号 */
    postRegisterImport(params, headers, search) {
        return this.postMultipart(this.OBJ.RegisterBibImportUrl, params, headers, search);
    }

    /* 清空选手好列表 */
    postRegisterClearLists(headers, search) {
        return this.postMultipart(this.OBJ.RegisterBibClearUrl, {}, headers, search);
    }

    /* 选手更新 */
    postRegisterVerify(headers, search) {
        return this.postMultipart(this.OBJ.RegisterVerifyUrl, {}, headers, search);
    }

    /* 选手支付状态更新 */
    postRegisterPaystatus(headers, search) {
        return this.postMultipart(this.OBJ.RegisterPaystatusUrl, {}, headers, search);
    }


    /* 添加自定义字段 */
    getRegisterfieldAdd(headers, search) { 
        return this.getRequest(this.OBJ.RegisterfieldAddUrl, headers, search);
    }

    /* 添加自定义字段(提交) */
    postRegisterfieldAdd(params, headers, search) {
        return this.postRequest(this.OBJ.RegisterfieldAddUrl, params, headers, search);
    }

    /* 修改自定义字段(提交) */
    postRegisterfieldAdd(params, headers, search) {
        return this.postRequest(this.OBJ.RegisterfieldAddUrl, params, headers, search);
    }

    /* 编辑自定义字段(提交) */
    postRegisterfieldEdit(params, headers, search) {
        return this.postRequest(this.OBJ.RegisterfieldEditUrl, params, headers, search);
    }

    /* 删除自定义字段 */
    postRegisterfieldDel(params, headers, search) {
        return this.postRequest(this.OBJ.RegisterfieldDelUrl, params, headers, search);
    }

    /* 取消报名 */
    postRegisterCancel(headers, search) {
        return this.postMultipart(this.OBJ.RegisterCancelUrl, {}, headers, search);
    }


}

export default EntryService;